package HomeCare_JobLancementProgramme;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/* Define a job in order to test Quartz job scheduler 
 * Job : open and read a existing file
 * This job will be scheduled by JobScheduler class
 * Author Phan
 */ 

public class ReadFile implements Job{
	
	private static Logger _log = LoggerFactory.getLogger(ReadFile.class);
	
	public void execute(JobExecutionContext context) throws JobExecutionException 
	{
		try {
			String[] command = { "cmd.exe", "/C", "Start", "/TestJobLancement/BATtest.bat"};
	           	Runtime r = Runtime.getRuntime();
	            Process p = r.exec(command);
	            p.waitFor();

	            } 
		catch (Exception e) 
	            {
	            _log.info("erreur d'execution: ");
	            e.printStackTrace();}
	}		
}


